Skip to content

ci(codecov): use one coverage upload per build like autoware_universe - #1563

Merged
mitsudome-r merged 6 commits into
mainfrom
ci/codecov-setup
Nov 24, 2026
Merged

mitsudome-r merged 6 commits into
mainfrom
ci/codecov-setup

Conversation

@xmfcx

@xmfcx xmfcx commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Codecov turns most commits on main and many PRs red, so a real CI failure is hard to see. 24 of the last 40 commits on main and 5 of the 8 newest PRs with Codecov checks have at least one failed Codecov status. The PR coverage numbers also jump, for example differential-jazzy 28.80% (-26.86%).

This PR copies the Codecov setup of autoware_universe:

Before After
Push to main 4 uploads: total-humble, total-jazzy, total-humble-agnocast, total-jazzy-agnocast 1 upload from jazzy: full-suite
Nightly build 2 uploads: daily-humble, daily-jazzy 1 upload from jazzy: daily
PR 3 uploads: differential-humble, differential-jazzy twice (with and without agnocast) 1 upload from jazzy, no flag
Carryforward All flags, also the old total and differential flags that no workflow uploads full-suite only
Upload action v5 on main, v4 on PRs (gcov runs again, the workspace search sends extra files) v6 everywhere, disable_search, plugins: noop
Statuses 22 on main, 22 checks on PRs, target: auto with no threshold codecov/project and codecov/patch, informational

Why each part:

  • Carryforward (reuse of the last upload for a flag with no new upload) is all or nothing per flag. A PR upload with the full-suite flag would replace that baseline with partial data. A flagless PR upload merges on top of it.
  • The v4 PR upload ran gcov again and sent total_coverage.info.nofilt (the report before filtering), coverage_base.info, and .gcov files for headers in /usr/include and /opt/ros. plugins: noop turns off all uploader plugins, as the push build on main already does. colcon-test makes the coverage files, so no plugin is needed.
  • target: auto with no threshold fails on a drop of 0.01%, and coverage moves by that much between runs without code changes. Informational statuses report the numbers and never fail. To make Codecov block a PR later, remove informational: true from project and add a threshold.

What changes for readers:

  • Humble and agnocast coverage are no longer uploaded. The README badges and the dashboard show the jazzy full-suite numbers, about 82 % instead of today's 71.83 %, because the stale flags leave the report. Python files change this number again when they arrive.
  • Python coverage is not reported today, and this PR does not change that. colcon-test outputs the raw .coverage file, which Codecov does not read. A separate PR makes colcon-test output an XML report. After its release, the upload in this PR sends that report with no further change:
  • fix(colcon-test): output the Python coverage as coverage.py XML autoware-github-actions#440
  • An open PR runs the new workflows on its next CI run, because a pull_request run uses the merge commit. Codecov reads codecov.yaml from the PR head, so the old status rules stay until the PR is updated from main, and a red Codecov check is possible until then. PR baselines are correct after the first push build on main uploads full-suite.
  • setup.py is added to the ignore list. It runs only at build time, so Python coverage would report it with 0 hits.
  • A PR report is the full-suite baseline plus the PR upload. A PR that removes a test does not show the drop until it is merged. Patch coverage is not affected.

History

The coverage.status and flag_management blocks came from sync-file-templates in 2022 and did not change after that. In 2025, a PR removed codecov.yaml from the sync list, and a later PR introduced the per-distro flag names:

autoware_universe reached its setup in these PRs:

Two differences:

  • autoware_universe keeps the per-flag statuses with target: 0% and threshold: 100%. This PR removes them and uses informational: true, which gives the same result with fewer statuses.
  • autoware_universe uses plugins: pycoverage to turn off the gcov plugin. The pycoverage plugin needs a coverage command, which the images do not have, so it does nothing. This PR uses plugins: noop, the documented value to turn off all plugins.

Tracking issue:

AI usage

AI usage: Written with Claude Code. It collected the Codecov statuses on main and on recent PRs, read the upload logs, copied the autoware_universe setup into the core workflows, and wrote this description.

Self-review: A reviewer with a clean context read the diff, the five workflows, codecov.yaml, the Codecov and codecov-action documentation, the autoware_universe setup, the cited CI logs and the public Codecov API. Two review rounds ran. The first round found three wrong statements in the description, and these are fixed. The second round found no defect in the workflow logic and two open points, plugins: noop as the documented off switch and the sentence about open PRs, and these are fixed. A third review round checked the commit that adds **/setup.py to ignore against the Codecov validator and the Codecov report of the test upload, and it found no defect.

Verification: The Codecov validator accepts the new codecov.yaml, and pre-commit and actionlint pass on the changed files. A temporary test commit uploaded Python coverage through the PR 440 branch, and Codecov posted only the two informational checks. The full-suite baseline shows only after the merge.

Status history

Upload logs before this PR

  • PR job build-and-test-diff-jazzy of run 45230998214 (codecov-action@v4): the uploader ran the GcovPlugin on 10 .gcno files and sent coverage_base.info, total_coverage.info.nofilt and .gcov files for /usr/include and /opt/ros headers, besides lcov/total_coverage.info.
  • The same job logs coverage.py is not installed or can't be found. for the Pycoverage plugin.
  • The same run, job build-and-test-diff-jazzy-agnocast: do-upload -f lcov/total_coverage.info -F differential-jazzy, the same flag as the job without agnocast.
  • main push job build-and-test-jazzy of run 45238075211 (codecov-action@v5, plugins: noop): Found 2 coverage files to report, lcov/total_coverage.info and coveragepy/.coverage.
  • The new v6 flagless PR upload ran once, in the test upload below.
  • Not run in core: the tokenless v6 upload from a fork PR. Fork PRs in autoware_universe get head reports with the same setup.

Test upload on this PR

A temporary commit, b6d67bda, pointed colcon-test in the PR build at the branch of autowarefoundation/autoware-github-actions#440 and touched autoware_interface_spec_lint. A revert commit removed it, and the tree is the same as before the test.

  • Job build-and-test-diff-jazzy of run 45272414449: modified-packages: autoware_interface_spec_lint, Wrote XML report to coveragepy/coverage.xml, then upload-coverage ... --disable-search --file coveragepy/coverage.xml --plugin noop with no flag, Found 1 coverage files to report and status_code=200.
  • Codecov API for the commit: 6 .py files under common/autoware_interface_spec_lint/, for example checks.py with 264 hits and 21 partials of 317 lines. The test files are left out by ignore. One of the 6 files is setup.py with 0 hits, which this PR now adds to ignore.
  • Check runs on the commit: only codecov/patch (success, Coverage not affected when comparing 15ab458...b6d67bd) and codecov/project (success, 79.62% (+7.78%) compared to 15ab458).
  • The report has 1 session and no C++ baseline, because main has no full-suite upload yet. The +7.78% compares 6 Python files with the old flags of main. Not checked: a PR report with a carried-forward full-suite session. That needs the first push build after the merge.

Static checks

  • curl --data-binary @codecov.yaml https://codecov.io/validate printed Valid!.
  • pre-commit run --files codecov.yaml .github/workflows/*.yaml: check yaml, prettier and yamllint passed.
  • actionlint -shellcheck= on the five changed workflows: no findings. With shellcheck on, it reports SC2086 and SC2044 notes in run: scripts that this PR does not change.
  • gh api repos/autowarefoundation/autoware_core/rules/branches/main: no required status check starts with codecov.

Codecov posted 22 statuses on each main commit and 22 checks on each PR, one project and one patch status for each flag. With target auto and no threshold, a coverage drop of 0.01 % failed a status, and one failure turned the commit red. The PR upload also ran gcov again and sent extra reports and system header files.

Use the setup that autoware_universe uses:

- Upload coverage only from the jazzy job without above and agnocast: flag full-suite on push to main, flag daily on the nightly build, and no flag on PRs.
- Carry forward only full-suite. A flagless PR upload keeps the full-suite baseline and merges on top of it.
- Use codecov-action v6 with disable_search and only the pycoverage plugin on every upload.
- Make the default project and patch statuses informational and remove the per-flag statuses.

Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
@xmfcx xmfcx added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Nov 23, 2026
@xmfcx xmfcx self-assigned this Nov 23, 2026
@github-actions

Copy link
Copy Markdown

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

The pycoverage plugin does nothing in the Autoware images, because they have no coverage command. colcon-test already makes the coverage files, so no plugin is needed. noop is the documented value to turn off all plugins, and the main build used it before.

Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
…branch

Point the PR build at autowarefoundation/autoware-github-actions branch fix/colcon-test-coveragepy-xml and touch autoware_interface_spec_lint, so that this PR uploads a coverage.py XML report to Codecov. Revert this commit before the merge.

Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
@github-actions

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.62%. Comparing base (15ab458) to head (b6d67bd).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1563      +/-   ##
==========================================
+ Coverage   71.83%   79.62%   +7.78%     
==========================================
  Files         518        6     -512     
  Lines       28732      481   -28251     
  Branches    13306      115   -13191     
==========================================
- Hits        20640      383   -20257     
+ Misses       6912       69    -6843     
+ Partials     1180       29    -1151     
Flag Coverage Δ
daily-humble ?
daily-jazzy ?
differential-humble ?
differential-jazzy ?
total ?
total-humble ?
total-humble-agnocast ?
total-jazzy ?
total-jazzy-agnocast ?

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…test PR branch"

This reverts commit b6d67bd. The test upload is done.

Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
Codecov carries a flag forward when the commit has no upload with that flag. An upload with another flag does not stop it. So the reason to upload PR coverage without a flag is that a PR upload with the full-suite flag would replace the carried-forward baseline.

Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
setup.py of an ament_python package runs only at build time, so Python coverage reports it with 0 hits. Leave it out of the coverage numbers, as the test folders already are.

Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
@mitsudome-r
mitsudome-r merged commit b46bc5f into main Nov 24, 2026
24 of 26 checks passed
@mitsudome-r
mitsudome-r deleted the ci/codecov-setup branch November 24, 2026 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants